package com.linxianqin.springbootVue.domain.convert;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.linxianqin.springbootVue.domain.dto.SysDictDataDTO;
import com.linxianqin.springbootVue.domain.dto.SysDictTypeDTO;
import com.linxianqin.springbootVue.domain.entity.SysDictData;
import com.linxianqin.springbootVue.domain.entity.SysDictType;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface SysDictTypeConvert {
    SysDictTypeConvert INSTANCE = Mappers.getMapper(SysDictTypeConvert.class);

    SysDictTypeDTO entity2dto(SysDictType dictType);
    List<SysDictTypeDTO> entity2dto(List<SysDictType> dictType);
    SysDictType dto2entity(SysDictTypeDTO dictTypeDTO);

    @Mappings({
            @Mapping(target = "ascs",ignore = true),
            @Mapping(target = "asc",ignore = true),
            @Mapping(target = "descs",ignore = true),
            @Mapping(target = "desc",ignore = true),
    })
    Page<SysDictTypeDTO> entity2dto(Page<SysDictType> page);

    @Mappings({
            @Mapping(target = "ascs",ignore = true),
            @Mapping(target = "asc",ignore = true),
            @Mapping(target = "descs",ignore = true),
            @Mapping(target = "desc",ignore = true),
    })
    Page<SysDictType> dto2entity(Page<SysDictTypeDTO> page);
}
